package com.qf.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsAdminMapper;
import com.qf.pojo.DtsAd;
import com.qf.pojo.DtsAdmin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

@Service
public class AdminServiceImpl implements AdminService{
   @Autowired
   private DtsAdminMapper dtsAdminMapper;

    /**
     * 按照用户名查询用户
     * @param username
     * @return
     */
    @Override
    public List<DtsAdmin> findAdminByName(String username) {
        QueryWrapper<DtsAdmin> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username",username);
        List<DtsAdmin> list = dtsAdminMapper.selectList(queryWrapper);
        return list;
    }

    @Override
    public List<DtsAdmin> findAll() {

        QueryWrapper<DtsAdmin> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("deleted",false);
        List<DtsAdmin> dtsAdmins = dtsAdminMapper.selectList(queryWrapper);
        return dtsAdmins;
    }
}
